#include "DataStruct.h"

Train::Train(const Train&temp)
{
    ID = temp.ID;
    stationList.clear();
    timeList.clear();
    for(int i = 0; i < temp.length(); i++)
    {
        stationList+=temp.stationList[i];
        timeList+=temp.timeList[i];
    }

}

void Train::appendStation(Station& station, QTime& time)
{
    stationList.append(station);
    timeList.append(time);
}

void Train::deleteStation(int index)
{
    stationList.removeAt(index);
    timeList.removeAt(index);
}

void Train::getItem(Station &out_station, QTime &out_time, int index)
{
    out_station = stationList.at(index);
//    out_station.name = stationList.at(index).name;
//    out_station.ID = stationList.at(index).ID;
    out_time = timeList.at(index);
}

void Train::insertStation(Station station, QTime time, int index)
{
    stationList.insert(index,station);
    timeList.insert(index,time);
}

int Train::length() const
{
    return stationList.length();
}
